import request from '@/utils/request'

// 管理员登录
export function login(data) {
  return request({
    url: '/manager/login',
    method: 'post',
    data
  })
}

// 获取用户信息
export function getInfo() {
  return new Promise((resolve) => {
    const roles = ['admin']
    const avatar = 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif'
    const introduction = 'I am a super administrator'
    const data = {
      roles, name, avatar, introduction
    }
    const res = {
      code: 200,
      data: data
    }
    resolve(res)
  })
}

// export function getInfo(token) {
//   return request({
//     url: '/user/info',
//     method: 'get',
//     params: { token }
//   })
// }

// 退出登录
export function logout() {
  return new Promise((resolve) => {
    const res = {
      code: 200,
      data: {}
    }
    resolve(res)
  })
}

// 修改密码
export function update(data) {
  return request({
    url: '/manager/update',
    data
  })
}
